package com.kzd.sdk.ui.fragment;

import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.kzd.sdk.base.OwnerFragment;
import com.kzd.sdk.entity.KZD_GameIssue;
import com.kzd.sdk.ui.adapter.KZD_GameIssueAdapter;
import com.kzd.sdk.utils.AppUtils;

import java.util.ArrayList;
import java.util.List;

public class KZD_RebateGuideFragment extends OwnerFragment {

    private RecyclerView mRecyclerView;
    private SwipeRefreshLayout mSwipeRefreshLayout;

    private KZD_GameIssueAdapter mGameIssueAdapter;

    @Override
    public String getLayoutIdByName() {
        return "kzd_include_app_recycler";
    }

    @Override
    public void initView(View view) {
        mRecyclerView = view.findViewById(AppUtils.getId(mContext, "mRecyclerView"));
        mGameIssueAdapter = new KZD_GameIssueAdapter(mContext);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mRecyclerView.setAdapter(mGameIssueAdapter);

        mSwipeRefreshLayout = view.findViewById(AppUtils.getId(mContext, "mSwipeRefreshLayout"));
        mSwipeRefreshLayout.setColorSchemeResources(AppUtils.getColorId(mContext, "kzd_2983ff"));
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                initData();
            }
        });

    }

    @Override
    public void initData() {

        List<KZD_GameIssue> issueList = new ArrayList<>();
        KZD_GameIssue issue1 = new KZD_GameIssue("为什么充值后没有可申请的返利",
                "①请确保APP登录账户与游戏充值账户一致;\n②请查看您的充值金额是否满足游戏返利所需要求;\n③游戏返利仅限充值后24小时内申请,逾期无法申请,请联系客服;\n④已提交过申请,但申请失败了,请在申请记录中查看详情并重新发起申请。");
        issueList.add(issue1);
        KZD_GameIssue issue2 = new KZD_GameIssue("返利多久会到",
                "一般提交后,若核实返利申请信息正确,将在一个工作日内发放到您;如果您的信息有误,将会打回给您重新修改提交,提交后再核实处理,因此请提交时务必确认信息正确性。");
        issueList.add(issue2);
        KZD_GameIssue issue3 = new KZD_GameIssue("返利是返还到哪里",
                "一般来说,分以下几种:\n①直接发放该游戏的绑币，用于充值;\n②直接发放到您的角色上,需要仔细注意金额的变化;\n③发放到背包里,需要使用后才获得元宝等(类似元宝卡钻石卡之类);\n④在游戏界面的某个【领奖】图标上点击领取;\n⑤游戏内邮件发放【常见方式】;\n⑥激活码形式发放,一般是直接在APP中以消息通知的方式发放到您。");
        issueList.add(issue3);
        KZD_GameIssue issue4 = new KZD_GameIssue("节假日延迟说明",
                "①非绑币的游戏返利为游戏商操作发放;\n②部分游戏商节假日无法处理返利,因而将延期至正常工作日补发处理;\n③若节假日过长,则游戏商会间隔2-3日内处理发放一次;如未发放成功,最迟工作日会完成补发,请勿担心。");
        issueList.add(issue4);
        KZD_GameIssue issue5 = new KZD_GameIssue("为什么会申请失败",
                "①角色信息错误:区服不对/角色名不对/申请中改名/角色ID不对等等;\n②有道具奖励,申请时不填写道具内容,导致道具奖励发放失败;\n③有道具奖励,并且其中有道具只能选择某一种时,不明确说明到底要哪个将导致发放失败;\n④填写道具奖励,和实际活动奖励内容不一致,胡乱填写将导致发放失败。");
        issueList.add(issue5);
        KZD_GameIssue issue6 = new KZD_GameIssue("申请失败后如何重新提交查看",
                "【申请记录】-【详情】-查看失败原因并修改重新提交");
        issueList.add(issue6);
        KZD_GameIssue issue7 = new KZD_GameIssue("没有收到怎么办",
                "①如状态还未有提示“已发放\",属于正在发放中,请等待;\n②状态已提示发放,仍然没有到,请联系客服并提交信息查询;\n③部分游戏会优先发放元宝返利,而道具奖励需要统计发放内容因此将稍晚(一个工作日内)返还到,请耐心等待!");
        issueList.add(issue7);
        KZD_GameIssue issue8 = new KZD_GameIssue("发放奖励不对怎么办",
                "①返利计算公式:充值金额*游戏实际充值比例(非首充比例) *游戏返还比例\n②请联系客服咨询");
        issueList.add(issue8);

        mGameIssueAdapter.setNewInstance(issueList);
        mSwipeRefreshLayout.setRefreshing(false);
    }

}
